package com.cc.service.impl;

import com.cc.dao.TransactionsDao;
import com.cc.dao.impl.TransactionsDaoImpl;
import com.cc.entity.Page;
import com.cc.entity.Transactions;
import com.cc.service.TransactionsService;

public class TransactionsServiceImpl implements TransactionsService {
    TransactionsDao transactionsDao = new TransactionsDaoImpl();
    @Override
    public Page<Transactions> getTransactionsList(Page<Transactions> page, int userId) {
        return transactionsDao.getTransactionsList(page, userId);
    }

    @Override
    public boolean edit(Transactions transactions) {
        if (transactions.getId() == 0) {
            return transactionsDao.insert(transactions)==1;
        }else {
            return transactionsDao.edit(transactions)==1;
        }
    }

    @Override
    public boolean delete(int id) {
        return transactionsDao.delete(id)==1;
    }
}
